import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  // 过渡页
  { path: '/' },
  // 登录页面
  { path: '/login', name: 'login', component: () => import('../views/login') },
  // 404页面
  {
    path: '/error404',
    name: 'error404',
    component: () => import('../views/error404')
  },
  // 首页
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/index'),
    children: [
      // 系统-用户管理
      {
        path: 'admin',
        name: 'XT_YHGL',
        component: () => import('../views/system/admin/admin')
      },
      // 系统-角色管理
      {
        path: 'role',
        name: 'XT_JSGL',
        component: () => import('../views/system/role/role')
      },
      // 系统-配置管理
      {
        path: 'config',
        name: 'XT_PZGL',
        component: () => import('../views/system/config/config')
      },
      // 系统-APP版本管理
      {
        path: 'app-edition',
        name: 'XT_APPBBGL',
        component: () => import('../views/system/edition/edition')
      },
      // 系统-菜单管理
      {
        path: 'permission',
        name: 'XT_CDGL',
        component: () => import('../views/system/permission/permission')
      },
      // 系统-小程序管理
      {
        path: 'mini-program-management',
        name: 'XT_XCXGL',
        component: () =>
          import(
            '../views/system/mini-program-management/mini-program-management'
          )
      },

      // 系统-工厂管理
      {
        path: 'factory-management',
        name: 'XT_GCGL',
        component: () => import('../views/system/factory-management/list')
      },
      // 系统-门店管理
      {
        path: 'poi-management',
        name: 'XT_MDGL',
        component: () => import('../views/system/poi-management/list')
      },

      // 商城-商品管理
      {
        path: 'mall-goods',
        name: 'SC_SPGL',
        component: () => import('../views/mall/goods/goods')
      },
      // 商城-banner管理
      {
        path: 'banner',
        name: 'SC_BNGL',
        component: () => import('../views/mall/banner/banner')
      },
      // 商城-分类管理
      {
        path: 'mall-type',
        name: 'SC_FLGL',
        component: () => import('../views/mall/type/type')
      },
      // 商城-运费模板
      {
        path: 'freight',
        name: 'SC_YFMB',
        component: () => import('../views/mall/freight/freight')
      },
      // 商城-
      {
        path: 'mall-order',
        name: 'SC_DDGL',
        component: () => import('../views/mall/order/order')
      },
      // 商城-运费模板
      {
        path: 'mall',
        name: 'SC_SHGL',
        component: () => import('../views/mall/mall/mall')
      },
      // 用户-用户管理
      {
        path: 'user',
        name: 'YH_YHGL',
        component: () => import('../views/user/user/user')
      },
      // 用户-消息管理
      {
        path: 'message',
        name: 'YH_XXGL',
        component: () => import('../views/user/message/message')
      },
      // 会员-商品管理
      {
        path: 'vip-goods',
        name: 'HY_SPGL',
        component: () => import('../views/vip/goods/goods')
      },
      // 会员-订单管理
      {
        path: 'vip-order',
        name: 'HY_DDGL',
        component: () => import('../views/vip/order/order')
      },
      // 会员-充值管理
      {
        path: 'recharge',
        name: 'HY_CZGL',
        component: () => import('../views/vip/recharge/recharge')
      },
      // 会员-提现管理
      {
        path: 'withdrawal',
        name: 'HY_TXGL',
        component: () => import('../views/vip/withdrawal/withdrawal')
      },
      // 营销-签到管理
      {
        path: 'sign',
        name: 'YX_QDGL',
        component: () => import('../views/marketing/sign/sign')
      },
      // 营销-活动弹框
      {
        path: 'popup',
        name: 'YX_HDTK',
        component: () => import('../views/marketing/popup/popup')
      },

      // 工作台-首页
      {
        path: 'home',
        name: 'GZT_HOME',
        component: () => import('../views/home/home')
      },
      // 洗衣管理-工厂订单
      {
        path: 'wash/order',
        name: 'XYGL_GCDD',
        component: () => import('../views/wash/order')
      },
      // 洗衣管理-洗衣对账
      {
        path: 'wash/checking',
        name: 'XYGL_GCDZ',
        component: () => import('../views/wash/checking')
      },
      // 洗衣管理-商品管理
      {
        path: 'wash/goods',
        name: 'XYGL_YYGOODS',
        component: () => import('../views/wash/goods/goods.vue')
      },
      // 洗衣管理-团购订单
      {
        path: 'wash/group',
        name: 'XYGL_GROUP',
        component: () => import('../views/wash/group/group.vue')
      },
      // 洗衣管理-运营订单管理
      {
        path: 'wash/operation-order',
        name: 'XYGL_OPORDER',
        component: () => import('../views/wash/operation-order/order.vue')
      },
      // 洗衣管理-异常订单
      {
        path: 'wash/abnormal-order',
        name: 'XYGL_ABORDER',
        component: () => import('../views/wash/abnormal-order/order.vue')
      },
      // 洗衣管理-手动录单
      {
        path: 'wash/manual',
        name: 'XYGL_MTSDLD',
        component: () => import('../views/wash/manual/index.vue')
      },
      // 洗衣管理-抖音商品管理
      {
        path: 'wash/douyin-goods-management',
        name: 'XYGL_DY_SPGL',
        component: () =>
          import('../views/wash/douyin/douyin-goods-management.vue')
      },
      // 商品管理-抖音家政商品管理
      {
        path: 'wash/douyin-jz-goods-management',
        name: 'SPGL_DYJZSPGL',
        component: () =>
          import(
            '../views/goods-management/douyin/douyin-jz-goods-management.vue'
          )
      },
      // 商品管理-快手家政商品管理
      {
        path: 'wash/ks-homemaking-goods-management',
        name: 'SPGL_KSJZSPGL',
        component: () =>
          import(
            '../views/goods-management/kuaishou/ks-homemaking-goods-management.vue'
          )
      },
      {
        path: 'homemaking/group-order',
        name: 'HOMEMAKING_GROUP_ORDER',
        component: () =>
          import('../views/homemaking/group-order/group-order.vue')
      },
      // wx-goods-management 微信商品管理
      {
        path: 'wash/wx-goods-management',
        name: 'HOMEMAKING_WX_GROUP_ORDER',
        component: () =>
          import('../views/goods-management/weixin/wx-goods-management.vue')
      },
      // 一城一店
      {
        path: 'store-platform/store-management',
        name: 'MDXYGL_MDGL',
        component: () => import('../views/store-platform/store-management.vue')
      },
      {
        path: 'store-platform/store-order',
        name: 'MDXYGL_MDYYDD',
        component: () => import('../views/store-platform/store-order.vue')
      },
      // store-manual-order
      {
        path: 'store-platform/store-manual-order',
        name: 'MDXYGL_MDSDLD',
        component: () =>
          import('../views/store-platform/store-manual-order.vue')
      }
    ]
  }
];

const router = new VueRouter({
  mode: 'history',
  base: '/laundry-web',
  // publicPath: '/test-store-web',
  routes
});
const VueRouterPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err);
};

export default router;
